import processing.core.PConstants;


public class Ellipse {
	float x, y;
	float width, height;
	int color;
	int index; //Index of Artist in list
	String name = "";
	int listeners = 0;
	int count = 0;
	
	public Ellipse(float _x, float _y, float w, float h) {
		x = _x;
		y = _y;
		width = w;
		height = h;
		color = GLOBAL.colorEllipse;
	}
	
	public Ellipse(float _x, float _y, float w, float h, int i) {
		x = _x;
		y = _y;
		width = w;
		height = h;
		color = GLOBAL.colorEllipse;
		index = i;
	}
	
	public Ellipse(float _x, float _y, float w, float h, int i, String n, int c, int l) {
		x = _x;
		y = _y;
		width = w;
		height = h;
		color = GLOBAL.colorEllipse;
		index = i;
		
		name = n;
		listeners = l;
		count = c;
	}
	
	public boolean mouseOver() {
        if(GLOBAL.processing.mouseX > x && GLOBAL.processing.mouseX < x+width && 
                        GLOBAL.processing.mouseY > y && GLOBAL.processing.mouseY < y+height) return true;
        return false;
    }

	public void draw() {	
		GLOBAL.processing.noStroke();
		if(mouseOver()) {
			int ytemp = 680;
			if(y<400)
				ytemp = 330;
			
			GLOBAL.processing.textAlign(PConstants.CENTER);
			GLOBAL.processing.fill(0);
			GLOBAL.processing.textFont(GLOBAL.fontSegoe, 12);
			GLOBAL.processing.text(name + "\nPlays: " + count + "\nListeners: " + listeners, x, ytemp);
			GLOBAL.processing.textAlign(PConstants.LEFT);
			GLOBAL.processing.fill(GLOBAL.colorEllipseHighlight);
			
			if(GLOBAL.processing.mousePressed) {
				GLOBAL.sendEventToView((int) y, index);
			}
		}
		else
			GLOBAL.processing.fill(color);
		
		GLOBAL.processing.ellipse(x, y, width, height);

	}
	
}
